home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
graphics
/
plotter.arj
/
PLOTTER.DOC
< prev
next >
Wrap
Text File
|
1993-08-06
|
4KB
|
67 lines
PLOTTER
This is a simple program for graphing functions y = f(x,z). Input
to the program is a file containing values of y in planes perpendicular
to the z-axis. These data points are first subjected to a rotation around
the y-axis through an angle of theta degrees, then around the x-axis through
alpha degrees. Then they are projected onto the xy-plane parallel to the
z-axis, and the projected coordinates are scaled so that the graph will fill
the viewing window.
The 'floating horizon' method of hidden line elimination is used; the
specific algorithm is a slight modification of that given in D. F. Rogers'
book, Procedural Elements for Computer Graphics, New York, 1985. A few sample
data files, FUNC0, FUNC1, ... FUNC9, are included. The file FUNC.LST contains
the functions and values used in calculating these data files.
Operation of the program itself is essentially self-explanatory. After
a data file is specified and loaded, a description of the function and the
default view angles is given at the bottom of the screen; you may either plot
the graph as loaded (by pressing Return or P), load a new file by pressing L,
or change the viewing angles by pressing V. After displaying the graph, the
program waits for a keypress, then offers the user a chance to choose new
viewing angles (in the range -45 to 45 degrees) or to select a new data file.
(If an input window is open, Esc cancels any input already made and closes
the window; from the main menu bar, Esc ends the program.)
The program MKDATA, which was used to create the sample files, can be
used to make additional data files, provided an ANSI C compiler is available.
To do this, edit MAKEDATA.C, changing the function f() as desired, then
compile and run the resulting program. You will be asked to enter the
following information:
filename [for output file; no check for existing file is made]
title [at most 70 characters]
x- and z-ranges (Xmin, Xmax, Zmin, Zmax)
number of x- and z-divisions (numX, numZ) [maximum 101]
default values of theta and alpha [range -45 to 45]
After this, the file will be written, and you will be given an opportunity to
run the program again, with the same function but different choices of the
above options. As noted below, there is a great advantage in speed of
operation if numX and numZ are each one more than a multiple of 5; for most
functions, 51 is a reasonable value for numX and numZ, but functions with
steep ascents or descents may need larger values (the maximum is 101).
An ASCII data file may also be used; it takes longer to load and requires
more disk space, but can be created and modified with an ordinary editor. It
MUST have the extension '.ASC', and the first line (which may be empty except
for a carriage return) should contain the title. This should be followed by:
1. the number of x-values and the number of z-values
2. the x-values, from smallest to largest
3. the z-values, from smallest to largest
4. the y-values, listed in order of z-value, x-value:
y[xmin][zmin] ... y[xmax][zmin]
.
.
y[xmin][zmax] ... y[xmax][zmax]
5. the default viewing angles, in degrees (optional)
The numeric data items should be separated by white space only.
Turbo C source code is included:
PLOTTER must be linked with HLPLOT (and GRAPHICS.LIB)
MKDATA is a stand alone program.
B. J. Ball 3304 Glen Rose Drive Austin, TX 78731